//
//  LcCell.m
//  18Birdies
//
//  Created by Lc on 15/4/2.
//  Copyright (c) 2015年 Lc. All rights reserved.
//

#import "LcCell.h"
#import "LcCellData.h"
#import "LcFoundation.h"

@interface LcCell ()
@property(nonatomic, assign) BOOL superCalled;
@end

@implementation LcCell

- (void)postContruct {
  self.superCalled = YES;
  // set clipsToBounds to NO to let selectedBackgroundView to cover seperators
  self.clipsToBounds = NO;
  self.contentView.clipsToBounds = YES;
  self.selectionStyle = UITableViewCellSelectionStyleDefault;
  self.selectedBackgroundView =
      [[UIView alloc] initWithFrame:CGRectMake(0, -1, self.bounds.size.width,
                                               self.bounds.size.height + 2)];
  self.selectedBackgroundView.backgroundColor = LC_COLOR_WHITE;
}

- (CGFloat)height {
  [self setNeedsUpdateConstraints];
  [self updateConstraintsIfNeeded];
  CGSize size = [self.contentView
      systemLayoutSizeFittingSize:UILayoutFittingCompressedSize];
  // +1 to fix system bug
  return size.height + 1;
}

@end
